<template>
  <div id="app">
    <h2>测试题</h2>
    <SubjectItem @submitFn="checkAnswer"></SubjectItem>
    <div>
      <FlagItem :statusList="statusList"></FlagItem>
    </div>
  </div>
</template>

<script>
import SubjectItem from "./components/SubjectItem.vue";
import FlagItem from "./components/FlagItem.vue";
 export default {
  components: {
    SubjectItem,
    FlagItem
  },
  data() {
    return {
      statusList:[]
    }
  },
  methods: {
    checkAnswer(a,b) {
      if (a == b) {
        this.statusList.push({
          result: '正确',
          });
      }
      else if (a !== b) {
        if(b==undefined)
          this.statusList.push({
            result: '未完成',
          });
        else
          this.statusList.push({
            result: '错误',
          });
      }
      
    }
  }
}

</script>
<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>